<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>

  <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
</head>
<body>
  <div id="app">

    <!-- vue语法识别区域 -->
    <ul>
      <li v-for="item in arr">{{item}}</li>
    </ul>

    <button @click="addHero">添加英雄</button>
  </div>
</body>
</html>
<script>
const {createApp} = Vue;

const vm = createApp({
  data (){
    return{
      arr :['刘备', '关羽', '张飞']
    }
  },

  methods:{
    addHero(){
      vm.arr.push('马超')

    }
  }
}).mount('#app')
</script>